home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / Clean Help / Clean Help.rsrc / STR#_10008.txt < prev    next >
Encoding:
Text File  |  1997-06-20  |  2.7 KB  |  123 lines

  1. 
  2.  
  3. Modules
  4.  
  5. 
  6.  
  7. ‚Ä¢   Implementation modules
  8.  
  9. 
  10.  
  11. An implementation module consists of a sequence of type, function, graph
  12.  
  13. and macro definitions. These definitions have in principle only a local
  14.  
  15. scope: they only have meaning in the implementation module they are
  16.  
  17. defined in. In the corresponding definition module one can specify which
  18.  
  19. types and rules (defined in the corresponding implementation module) are
  20.  
  21. exported, i.e. are made visible to the outside world.
  22.  
  23. 
  24.  
  25. 
  26.  
  27. 
  28.  
  29. ‚Ä¢   The main module
  30.  
  31. 
  32.  
  33. The main module is always an implementation module. In its module header
  34.  
  35. the keyword "implementation" can be left out. In that case the main
  36.  
  37. module does not need a corresponding definition module. Furthermore, a
  38.  
  39. main module should always contain an explicit or implicit declaration of
  40.  
  41. the Start rule, i.e. this rule should either be defined in the start module or
  42.  
  43. imported from another module. Any implementation module can become a
  44.  
  45. main module by inserting a start rule. This is helpful for the debugging of
  46.  
  47. modules.
  48.  
  49. 
  50.  
  51. 
  52.  
  53. 
  54.  
  55. ‚Ä¢   Definition modules
  56.  
  57. 
  58.  
  59. In a definition module one can specify which definitions (defined in the
  60.  
  61. corresponding implementation module) are exported, i.e. are made visible
  62.  
  63. to the outside world. To export a type or a function from an
  64.  
  65. implementation module one has to define their type definition in the
  66.  
  67. corresponding definition module. To export a macro the macro definition
  68.  
  69. from the implementation module has to be defined in the corresponding
  70.  
  71. definition module. All other definitions given in the implementation module
  72.  
  73. remain hidden.
  74.  
  75. 
  76.  
  77. 
  78.  
  79. 
  80.  
  81. ‚Ä¢   System modules
  82.  
  83. 
  84.  
  85. System modules are special definition modules indicated by the keyword
  86.  
  87. "system" instead of "definition". This indicates that the corresponding
  88.  
  89. implementation module does not contain ordinary Clean rules, but abstract
  90.  
  91. (P)ABC-machine code instead. This facility makes it possible to program
  92.  
  93. directly in (P)ABC-code. This can be used to increase execution speed of
  94.  
  95. heavily used functions or complex data structures. At demand, the Clean
  96.  
  97. compiler will substitute the ABC code of a function in-line at the place in
  98.  
  99. which the corresponding function is called. In this way execution speed is
  100.  
  101. increased even more.
  102.  
  103. 
  104.  
  105. 
  106.  
  107. System modules have as advantage that a certain increase of efficiency
  108.  
  109. can be obtained on a device independent manner, since (P)ABC-code is
  110.  
  111. device independent. It goes without saying that for (P)ABC programming
  112.  
  113. advanced knowledge is needed of the code generation schemes and the
  114.  
  115. run-time behaviour of the (P)ABC-machine. Imprudent programming of
  116.  
  117. system modules will generally lead to unpredictable errors. Typically, the
  118.  
  119. predefined arithmetic Std rules are implemented as system modules.
  120.  
  121. 
  122.  
  123.